package com.powernode.lambda.stream;


import com.powernode.lambda.Fruit;

import java.util.stream.Stream;

/**
 * 测试stream相关Api
 */
public class Stream01 {
    public static void main(String[] args) {
        Stream.of(
                new Fruit("草莓", "Strawberry", "浆果", "红色"),
                new Fruit("桑葚", "Mulberry", "浆果", "紫色"),
                new Fruit("杨梅", "Waxberry", "浆果", "红色"),
                new Fruit("核桃", "Walnut", "坚果", "棕色"),
                new Fruit("草莓", "Peanut", "坚果", "棕色"),
                new Fruit("蓝莓", "Blueberry", "浆果", "蓝色")
        )
                .filter(f->f.getColor().equals("红色"))
                .map(f->f.getCname()+"酱")
                .forEach(System.out::println);

    }

}
